package com.sky.controller.admin;

import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.result.Result;
import com.sky.service.DishService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
@RequestMapping("/admin/dish")
public class DishController {
    @Resource
    private DishService dishService;
    @PostMapping
    private Result addDish(@RequestBody  DishDTO dishDTO){
        dishService.addDish(dishDTO);
        return Result.success();
    }
    @GetMapping("/page")
    public Result queryAllDish(DishPageQueryDTO dto){
        return dishService.queryAllDish(dto);
    }

}
